<template>
  <div>
    <div class="item">
      <h1>全局自增</h1>
      <div>count: {{ count }}</div>
      <div class="btn" @click="incement()">incement()</div>
    </div>

    <h1>Getter</h1>
    <cu-getter></cu-getter>
  </div>
</template>

<script>
import { mapState } from "vuex";
import CuGetter from "./getter.vue";
export default {
  components: {
    "cu-getter": CuGetter
  },
  name: "Home",
  data() {
    return {};
  },
  computed: {
    ...mapState(["count"])
  },
  // computed: mapState(["count"]),
  // computed: {
  //   count() {
  //     return this.$store.state.count;
  //   }
  // },
  created() {},
  methods: {
    incement() {
      this.$store.commit("increment");
    }
  }
};
</script>


<style lang="less" scope>
.item {
  width: 100%;
  // height: ;
  border-bottom: 1px solid #ddd;
  padding: 10px 30px;
  .btn {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 8px;
    line-height: 30px;
    text-align: center;
    border: 1px solid #ddd;
    margin-top: 10px;
  }
}
</style>